Publish and Subscribe (pub/sub) is an effective way of disseminating information to multiple users. Pub/Sub applications can help to enormously simplify the task of getting business messages and transactions to a wide, dynamic and potentially large audience in a timely manner.
In a pub/sub system, publishers are typically not concerned with where their messages are going, and subscribers are typically not interested in where the messages they receive have come from. Instead, a message broker typically assures the integrity of the message source and manages the distribution of a message according to subscriptions registered in the message broker. Message topics typically provide the key to the delivery of messages between publishers and subscribers. The message broker attempts to match a topic string on a published message with a list of clients who have subscribed to receive publications including that topic string. In response to a match, the broker sends the published message to the subscriber.
FIG. 1 is a schematic diagram of a conventional data processing system (100), comprising a publisher (105), a broker (110) and a subscriber (125). The broker (110) comprises a match component (115) for matching a topic string on a published message with subscribers that have subscribed to receive publications including that topic string.
In current pub/sub systems, a publisher can request the broker to retain a current message, such that if a new subscriber subscribes to the broker, they can receive the current message from that publisher. The current message is retained in a storage component (120). In an example, if a publisher publishes a message and requests a broker to retain the published message, a subscriber who subsequently subscribes to a topic associated with the published message receives the published message immediately from the broker. This means that new subscribers do not have to wait for data to be published again before they receive it. The broker retains only one publication for each topic, so the previous publication is deleted when a new one arrives.
A disadvantage in current pub/sub systems is that a subscriber subscribing to a plurality of topics receives messages from the broker in a piecemeal fashion, that is, a subscriber receives a message whenever a message associated with a topic that they have subscribed to is published. It can be difficult for a subscriber to make sense of the messages that they receive, for example, if they have subscribed to several topics.